#pragma once


#include <iostream>
#include <utility>
#include <vector>
#include <map>
#include <cmath>

#include "processImg.h"
//#include "pubHead.h"


namespace analysis_img
{

	class peakLocation
	{
	public:
		peakLocation(){
			tpl = new float*[winw];
			dt = new float*[winw];
			for (int i = 0; i < winw; i++) {
				tpl[i] = new float[winw];
				dt[i] = new float[winw];
			}
		}
		~peakLocation(){
			for (int i = 0; i < winw; i++) {
				delete[] tpl[i];
				delete[] dt[i];
			}
			delete[] tpl;
			delete[] dt;
		}

	public:
		int run(cv::Mat &, std::vector<cv::Point2f> &, cv::Mat &, std::vector<float> &, const char *, float &, float &, float &, float &, float &, float &, float &, float &);
		void fastLaunch(cv::Mat &noise, const cv::Mat &intensity, cv::Mat &bg, float noisecounter, float sth, cv::Mat& mse, std::vector<cv::Point2f> &resultPosition, std::vector<float> &psc, float jg);
	protected:
		void gauss(float);
		double gaussMatch(float **a);
		//int recursion(int, int, cv::Mat &, std::vector< std::pair<int, int>  > &, const cv::Mat &, double &, unsigned long &);
	private:
		float **tpl;
		float **dt;
		float gj;
		float gjt;
		const static short winw = 5;
	};
};
